package stackexchange.posts;

import java.util.Calendar;
import java.util.Vector;

public class Question extends Post {
	private int acceptedAnswerId = -1;
	private int nAnswers;
	private int viewCount;
	private String title;
	private Vector<String> tags;
	private boolean answerAccepted = false;
	private boolean answered = false;
	private boolean popular = false;

	public Question(int postId, Calendar creationDate, int score, String body,
			int ownedUserId, Calendar lastEditDate, Calendar lastActivityDate,
			int nComments, int acceptedAnswerId, int nAnswers, int viewCount,
			String title, Vector<String> tags) {

		super(postId, creationDate, score, body, ownedUserId, lastEditDate,
				lastActivityDate, nComments);

		this.acceptedAnswerId = acceptedAnswerId;
		this.nAnswers = nAnswers;
		this.viewCount = viewCount;
		this.title = title;
		this.tags = tags;
		;
		analyzeQuestion();

	}

	private void analyzeQuestion() {
		if (nAnswers > 0) {
			answered = true;
		}
		if (acceptedAnswerId != 0) {
			answerAccepted = true;
		}
		if (viewCount > 1000) {
			popular = true;
		}
	}

	public int getAcceptedAnswerId() {
		return acceptedAnswerId;
	}

	public int getnAnswers() {
		return nAnswers;
	}

	public int getViewCount() {
		return viewCount;
	}

	public String getTitle() {
		return title;
	}

	public Vector<String> getTags() {
		return tags;
	}

	public boolean isAnswerAccepted() {
		return answerAccepted;
	}

	public boolean isAnswered() {
		return answered;
	}

	public boolean isPopular() {
		return popular;
	}

}
